<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>登录</title>
    <link rel="stylesheet" type="text/css" href="/css/login/normalize.css" />
    <link rel="stylesheet" type="text/css" href="/css/login/login.css" />
    <link rel="stylesheet" type="text/css" href="/css/style.css" />
</head>
<body>
<div class="container demo-1">
    <div class="content">
        <div id="large-header" class="large-header">
            <canvas id="demo-canvas"></canvas>
            <div class="logo_box">
                <h3>志力供应链平台运营系统欢迎你</h3>
                <div name="f">
                    <div class="input_outer">
                        <span class="u_user"></span>
                        <input name="logname" class="text" style="color: #FFFFFF !important" type="text" placeholder="请输入账户">
                    </div>
                    <div class="input_outer">
                        <span class="us_uer"></span>
                        <input name="logpass" class="text" style="color: #FFFFFF !important; position:absolute; z-index:100;" value="" type="password" placeholder="请输入密码">
                    </div>
                    <div class="mb2">
                        <button class="act-but submit" type="button"  style="color: #FFFFFF" id="login">登录</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div><!-- /container -->
<script src="/js/login/TweenLite.min.js"></script>
<script src="/js/login/EasePack.min.js"></script>
<script src="/js/login/init.js"></script>
<script src="/layui/layui.js"></script>
<script>
    layui.extend({
        message: '/js/message'
    });
    layui.use(['jquery','message'] , function () {
        var $ = layui.jquery,
            msg = layui.message;
        $(window).keydown(function(event){
            switch(event.keyCode) {
                case 13:
                    login($('#login') , $ , msg);
                    break;
            }
        });
        $('#login').click(function (e) {
            var _this = $(this);
            login(_this , $ , msg);
        })
    })
    var login = function (_this , $ , msg) {
        _this.attr('disabled' , true);
        _this.html('<img src="http://wh-alibaba-haha.oss-cn-shanghai.aliyuncs.com/work/loading-bars.svg" style="width: auto;height: 17px"/>');
        $.post('/api/login' , {
            username:$('input[name="logname"]').val(),
            password:$('input[name="logpass"]').val()
        },function (data) {
            if(data['code'] == 1){
                window.location.href = '/base/area';
            }else{
                _this.attr('disabled' , false);
                _this.html('登录');
                msg.msg({
                    content:'密码错误',
                    type:'warning',
                    duration:3000
                })
            }
        })
    }
</script>
</body>
</html>